package com.smart_campus.sys.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.smart_campus.sys.common.DataGridView;
import com.smart_campus.sys.vo.FeedbackVo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.smart_campus.sys.domain.Feedback;
import com.smart_campus.sys.mapper.FeedbackMapper;
import com.smart_campus.sys.service.FeedbackService;

import java.util.List;
import java.util.Map;

/**
 * ${Description}
 *
 * @author Alfred
 * @time: 2020/6/18 15:52
 */
@Service
public class FeedbackServiceImpl implements FeedbackService {

    @Resource
    private FeedbackMapper feedbackMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return feedbackMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Feedback record) {
        return feedbackMapper.insert(record);
    }

    @Override
    public int insertSelective(Feedback record) {
        return feedbackMapper.insertSelective(record);
    }

    @Override
    public Feedback selectByPrimaryKey(Integer id) {
        return feedbackMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Feedback record) {
        return feedbackMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Feedback record) {
        return feedbackMapper.updateByPrimaryKey(record);
    }

    @Override
    public DataGridView queryAllFeedback(FeedbackVo feedbackVo) {
        Page<Object> page = PageHelper.offsetPage(feedbackVo.getPage(), feedbackVo.getLimit());
        List<Map> map = feedbackMapper.queryAllFeedback(feedbackVo);
        return new DataGridView(page.getTotal(), map);
    }

    /**
     * 查询最大的排序吗
     *
     * @return
     */
    @Override
    public Integer queryMax() {
        return this.feedbackMapper.queryMax();
    }

    @Override
    public Integer queryByIdDept(Integer userId) {
        return this.feedbackMapper.queryByIdDept(userId);
    }



}

